<?php

    $username = $_POST["username"];
    $password = $_POST["password"];

    $con = mysqli_connect("localhost","root","123456","itbaizhan");
    if($con){
        mysqli_query($con,"set names utf8");
        $sql = "insert into user values (null,'$username','$password', null, null)";
        // $result返回影响行数
        $result = mysqli_query($con,$sql);
        if($result > 0){
            echo json_encode(array("msg"=>"注册成功"));
        }else{
            echo json_encode(array("msg"=>"注册失败"));
        }
    }else{
        echo json_encode(array("msg"=>"数据库连接失败"));
    }

?>